Coin Change | BFS Approach
Given an integer X and an array arr[] of length N consisting of positive integers, the task is to pick minimum number of integers from the array such that they sum up to N. Any number can be chosen infinite number of times. If no answer exists then print -1.Examples:...
read more
Count numbers from a given range whose product of digits is K
Given three positive integers L, R and K, the task is to count the numbers in the range [L, R] whose product of digits is equal to K...
read more
Count of vessels completely filled after a given time
Given two integers N and T denoting the number of levels and the number of seconds respectively, the task is to find the number of completely filled vessels after T seconds under given conditions:...
read more
Count of binary strings of length N having equal count of 0’s and 1’s and count of 1’s ≥ count of 0’s in each prefix substring
Given an integer N, the task is to find the number of possible binary strings of length N with an equal frequency of 0‘s and 1‘s in which frequency of 1‘s are greater or equal to the frequency of 0‘s in every prefix substring....
read more
Ways to sum to N using Natural Numbers up to K with repetitions allowed
Given two integers N and K, the task is to find the total number of ways of representing N as the sum of positive integers in the range [1, K], where each integer can be chosen multiple times....
read more
Maximum sum submatrix
Prerequisite: Kadane’s algorithm...
read more
Minimize cost of painting N houses such that adjacent houses have different colors
Examples:...
read more
Length of Longest Palindrome Substring
Given a string S of length N, the task is to find the length of the longest palindromic substring from a given string....
read more
Largest Square in a Binary Matrix with at most K 1s for multiple Queries
Given a binary matrix M where each element of the matrix will be 0 or 1, the task is to find the largest square that can be formed with center (i, j) and contains most K 1’s....
read more
Maximum score possible after performing given operations on an Array
Given an array A of size N, the task is to find the maximum score possible of this array. The score of an array is calculated by performing the following operations on the array N times:...
read more
Longest common subarray in the given two arrays
Given two arrays A[] and B[] of N and M integers respectively, the task is to find the maximum length of an equal subarray or the longest common subarray between the two given array....
read more
Number of paths from source to destination in a directed acyclic graph
Given a Directed Acyclic Graph with n vertices and m edges. The task is to find the number of different paths that exist from a source vertex to destination vertex....
read more